package com.harmontronics.hanma.paas.paas.service;

import cn.hutool.core.convert.Convert;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.harmontronics.hanma.paas.paas.consts.EnvEnum;
import com.harmontronics.hanma.paas.paas.domain.app.entity.HmDatasource;
import com.harmontronics.hanma.paas.paas.domain.app.repository.po.HmDatasourcePO;
import java.util.List;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.harmontronics.hanma.paas.paas.domain.app.service.HmDatasourceService;
import java.util.Map;


@Service("hmDatasourceAppService")
@DS("#header.App-Unique")
public class HmDatasourceAppService extends HmDatasourceService {

    @Value("${app.env:DEV}")
    private String env;

    public List<HmDatasource> getAll(){
        List<HmDatasource> datasourceList = this.getList();
        this.fillEnvListByEnv(datasourceList,env);
        return datasourceList;
    }

    public List<HmDatasource> getAllBySetupType(EnvEnum setupType){
        List<HmDatasource> datasourceList = this.getList();
        this.fillEnvListByEnv(datasourceList,setupType.name());
        return datasourceList;
    }
}